import request from '@/utils/request'

export function listStockPendingBuyPool(query) {
  return request({
    url: '/stock/pending/buy/pool/list',
    method: 'post',
    data: query
  })
}

export function pageStockPendingBuyPool(query) {
   // 分离分页参数和查询参数
  const { pageNum, pageSize, orderByColumn, isAsc, ...searchParams } = query;
  return request({
    url: '/stock/pending/buy/pool/list',
    method: 'post',
    data: searchParams,
    params: {  // 分页参数和排序参数放在URL参数中
      pageNum: pageNum,
      pageSize: pageSize,
      orderByColumn: orderByColumn,
      isAsc: isAsc
    }
  })
}

export function getStockPendingBuyPool(id) {
  return request({
    url: `/stock/pending/buy/pool/${id}`,
    method: 'get'
  })
}

export function addStockPendingBuyPool(data) {
  return request({
    url: '/stock/pending/buy/pool/save',
    method: 'post',
    data: data
  })
}

export function updateStockPendingBuyPool(data) {
  return request({
    url: '/stock/pending/buy/pool',
    method: 'put',
    data: data
  })
}

export function delStockPendingBuyPool(id) {
  return request({
    url: `/stock/pending/buy/pool/${id}`,
    method: 'delete'
  })
}